home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Periodicals / develop / develop 3 code / Surf's Up! / Surfer / Surfer.r < prev    next >
Encoding:
Text File  |  1990-02-14  |  7.0 KB  |  327 lines  |  [TEXT/MPS ]

  1. /*------------------------------------------------------------------------------
  2. #
  3. #    Apple Products Presents
  4. #
  5. #    S U R F E R    ----- A CommToolbox Sample Application
  6. #        by Alex Kazim
  7. #
  8. #    Based on the MacDTS Simple Sample Application
  9. #
  10. #    Surfer.r    -    Rez Source
  11. #
  12. #    Copyright © 1988-9 Apple Computer, Inc.
  13. #    All rights reserved.
  14. #
  15. #    Versions:    Sample 1.0                    08/88
  16. #                Sample 1.01                    11/88
  17. #                Surfer 0.5                    08/89
  18. #                Surfer 1.01                    02/90
  19. ------------------------------------------------------------------------------*/
  20.  
  21.  
  22. #include "Types.r"
  23. #include "SysTypes.r"
  24. #include "Surfer.h"
  25.  
  26.  
  27. /* So the Finder can tell who we are    */
  28.  
  29. resource 'vers' (1) {
  30.     0x01, 
  31.     0x00, 
  32.     development, 
  33.     0x12, 
  34.     verUS,
  35.     "1.01",
  36.     "1.01, Copyright © Apple Computer, Inc. 1988-1990.  Written by Alex Kazim"
  37. };
  38.  
  39.  
  40. /* we use an MBAR resource to conveniently load all the menus */
  41.  
  42. resource 'MBAR' (rMenuBar, preload) {
  43.     { mApple, mFile, mEdit, mSettings };    /* four menus */
  44. };
  45.  
  46.  
  47. resource 'MENU' (mApple, preload) {
  48.     mApple, textMenuProc,
  49.     AllItems & ~MenuItem2,    /* Disable dashed line, enable About and DAs */
  50.     enabled, apple,
  51.     {
  52.         "About Surfer…",
  53.             noicon, nokey, nomark, plain;
  54.         "-",
  55.             noicon, nokey, nomark, plain
  56.     }
  57. };
  58.  
  59. resource 'MENU' (mFile, preload) {
  60.     mFile, textMenuProc,
  61.     MenuItem15,                /* enable Quit only, program enables others */
  62.     enabled, "File",
  63.     {
  64.         "New",
  65.             noicon, "N", nomark, plain;
  66.         "Open",
  67.             noicon, "O", nomark, plain;
  68.         "-",
  69.             noicon, nokey, nomark, plain;
  70.         "Close",
  71.             noicon, "W", nomark, plain;
  72.         "Save",
  73.             noicon, "S", nomark, plain;
  74.         "Save As…",
  75.             noicon, nokey, nomark, plain;
  76.         "Revert",
  77.             noicon, nokey, nomark, plain;
  78.         "-",
  79.             noicon, nokey, nomark, plain;
  80.         "Send File",
  81.             noicon, "T", nomark, plain;
  82.         "Receive File",
  83.             noicon, "R", nomark, plain;
  84.         "-",
  85.             noicon, nokey, nomark, plain;
  86.         "Page Setup…",
  87.             noicon, nokey, nomark, plain;
  88.         "Print…",
  89.             noicon, nokey, nomark, plain;
  90.         "-",
  91.             noicon, nokey, nomark, plain;
  92.         "Quit",
  93.             noicon, "Q", nomark, plain
  94.     }
  95. };
  96.  
  97. resource 'MENU' (mEdit, preload) {
  98.     mEdit, textMenuProc,
  99.     NoItems,                /* disable everything, program does the enabling */
  100.     enabled, "Edit",
  101.      {
  102.         "Undo",
  103.             noicon, "Z", nomark, plain;
  104.         "-",
  105.             noicon, nokey, nomark, plain;
  106.         "Cut",
  107.             noicon, "X", nomark, plain;
  108.         "Copy",
  109.             noicon, "C", nomark, plain;
  110.         "Paste",
  111.             noicon, "V", nomark, plain;
  112.         "Clear",
  113.             noicon, nokey, nomark, plain
  114.     }
  115. };
  116.  
  117. resource 'MENU' (mSettings, preload) {
  118.     mSettings, textMenuProc,
  119.     NoItems,                /* disable everything, program does the enabling */
  120.     enabled, "Settings",
  121.      {
  122.         "Connection…",
  123.             noicon, "1", nomark, plain;
  124.         "File Transfer…",
  125.             noicon, "2", nomark, plain;
  126.         "Terminal…",
  127.             noicon, "3", nomark, plain
  128.     }
  129. };
  130.  
  131.  
  132. /* this ALRT and DITL are used as an About screen */
  133.  
  134. resource 'ALRT' (rAboutAlert, purgeable) {
  135.     {40, 20, 180, 400},
  136.     rAboutAlert,
  137.     { /* array: 4 elements */
  138.         /* [1] */
  139.         OK, visible, silent,
  140.         /* [2] */
  141.         OK, visible, silent,
  142.         /* [3] */
  143.         OK, visible, silent,
  144.         /* [4] */
  145.         OK, visible, silent
  146.     }
  147. };
  148.  
  149. resource 'DITL' (rAboutAlert, purgeable) {
  150.     {    /* array DITLarray: 5 elements */
  151.         /* [1] */
  152.         {99, 285, 119, 365},
  153.         Button {
  154.             enabled,
  155.             "OK"
  156.         },
  157.         /* [2] */
  158.         {8, 8, 26, 250},
  159.         StaticText {
  160.             disabled,
  161.             "SURFER: A CommToolbox Application"
  162.         },
  163.         /* [3] */
  164.         {103, 6, 120, 251},
  165.         StaticText {
  166.             disabled,
  167.             "Copyright © 1988-90 Apple Computer."
  168.         },
  169.         /* [4] */
  170.         {52, 8, 69, 204},
  171.         StaticText {
  172.             disabled,
  173.             "Bytes by Alex, Words by Rob"
  174.         },
  175.         /* [5] */
  176.         {86, 6, 103, 211},
  177.         StaticText {
  178.             disabled,
  179.             "Based on Sample from MacDTS"
  180.         }
  181.     }
  182. };
  183.  
  184.  
  185. /* this ALRT and DITL are used as an error screen */
  186.  
  187. resource 'ALRT' (rUserAlert, purgeable) {
  188.     {40, 20, 180, 350},
  189.     rUserAlert,
  190.     { /* array: 4 elements */
  191.         /* [1] */
  192.         OK, visible, silent,
  193.         /* [2] */
  194.         OK, visible, silent,
  195.         /* [3] */
  196.         OK, visible, silent,
  197.         /* [4] */
  198.         OK, visible, silent
  199.     }
  200. };
  201.  
  202.  
  203. resource 'DITL' (rUserAlert, purgeable) {
  204.     { /* array DITLarray: 3 elements */
  205.         /* [1] */
  206.         {100, 230, 120, 310},
  207.         Button {
  208.             enabled,
  209.             "OK"
  210.         },
  211.         /* [2] */
  212.         {10, 60, 76, 310},
  213.         StaticText {
  214.             disabled,
  215.             "^0"
  216.         },
  217.         /* [3] */
  218.         {8, 8, 40, 40},
  219.         Icon {
  220.             disabled,
  221.             2
  222.         }
  223.     }
  224. };
  225.  
  226.  
  227. resource 'WIND' (rWindow, preload, purgeable) {
  228.     {40, 5, 340, 512},
  229.     noGrowDocProc, visible, noGoAway, 0x0, "Surf the Wave"
  230. };
  231.  
  232.  
  233. /* we put the latest SIZE template here so we can rez with MPW 2.0 */
  234.  
  235. type 'SIZE' {
  236.         boolean        dontSaveScreen,
  237.                     saveScreen;
  238.         boolean     ignoreSuspendResumeEvents,
  239.                     acceptSuspendResumeEvents;
  240.         boolean        enableOptionSwitch,
  241.                     disableOptionSwitch;
  242.         boolean        cannotBackground,
  243.                     canBackground;
  244.         boolean        notMultiFinderAware,
  245.                     multiFinderAware;
  246.         boolean        notOnlyBackground,
  247.                     onlyBackground;
  248.         boolean        dontGetFrontClicks,
  249.                     getFrontClicks;
  250.         unsigned bitstring[9] = 0;
  251.         unsigned longint;    /* preferred memory size in bytes */
  252.         unsigned longint;    /* minimum memory size in bytes */
  253. };    /* ignore the warning caused by re-defining SIZE */
  254.  
  255.  
  256. /* here is the quintessential MultiFinder friendliness device, the SIZE resource */
  257.  
  258. resource 'SIZE' (-1) {
  259.     dontSaveScreen,
  260.     acceptSuspendResumeEvents,
  261.     enableOptionSwitch,
  262.     canBackground,        /* we can background; we don't currently, but our sleep value */
  263.                         /* guarantees we don't hog the Mac while we are in the background */
  264.     multiFinderAware,    /* this says we do our own activate/deactivate; don't fake us out */
  265.     notOnlyBackground,    /* this is definitely not a background-only application! */
  266.     dontGetFrontClicks,    /* change this is if you want "do first click" behavior like the Finder */
  267.     kPrefSize * 1024,
  268.     kMinSize * 1024    
  269. };
  270.  
  271.  
  272. resource 'BNDL' (rBNDL) {
  273.     'SurF',
  274.     0,
  275.     {    /* array TypeArray: 2 elements */
  276.         /* [1] */
  277.         'FREF',
  278.         {    /* array IDArray: 1 elements */
  279.             /* [1] */
  280.             0, 128
  281.         },
  282.         /* [2] */
  283.         'ICN#',
  284.         {    /* array IDArray: 1 elements */
  285.             /* [1] */
  286.             0, 128
  287.         }
  288.     }
  289. };
  290.  
  291. data 'SurF' (0, "Owner resource") {
  292.     $"3B 43 6F 70 79 72 69 67 68 74 20 31 39 38 38 2D"    /* ;Copyright 1988- */
  293.     $"39 30 20 41 70 70 6C 65 20 43 6F 6D 70 75 74 65"    /* 90 Apple Compute */
  294.     $"72 20 49 6E 63 2E 20 20 41 6C 6C 20 52 69 67 68"    /* r Inc.  All Righ */
  295.     $"74 73 20 52 65 73 65 72 76 65 64 2E"                /* ts Reserved. */
  296. };
  297.  
  298. resource 'FREF' (rBNDL) {
  299.     'APPL',
  300.     0,
  301.     ""
  302. };
  303.  
  304. resource 'ICN#' (rBNDL) {
  305.     {    /* array: 2 elements */
  306.         /* [1] */
  307.         $"04 00 00 00 20 80 00 2C 0E 02 00 50 11 07 00 00"
  308.         $"51 4A 80 00 11 0A 81 60 0E 0A 82 90 20 9A 40 00"
  309.         $"04 12 40 00 00 12 50 40 00 12 48 80 00 12 47 00"
  310.         $"00 12 47 00 00 12 47 00 FF F2 77 7F 04 12 42 11"
  311.         $"40 52 4F 80 00 12 7F C4 01 12 7F C0 48 12 4F C0"
  312.         $"00 12 47 48 00 12 47 40 00 92 47 42 24 12 4F 80"
  313.         $"00 12 4D 80 00 12 4D 90 20 92 48 82 02 12 48 80"
  314.         $"00 12 58 C0 20 0F 98 C8 00 00 00 00 04 42 22 02",
  315.         /* [2] */
  316.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  317.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  318.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  319.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  320.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  321.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  322.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  323.         $"FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF"
  324.     }
  325. };
  326.  
  327.